﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 己方舰船
/// </summary>
public class OwnsideShipControllerBase : ControllerBase
{
    public Fleet fleet;
    public bool isAlive = true;
    protected bool isAdvance = false;


    public void Go()
    {
        isAdvance = true;

    }

    public void Update()
    {
        if (isAdvance)
        {
            ProcessFuelFromCargo();
        }

        UpdateView();
    }

    protected void ProcessFuelFromCargo()
    {
        if (fleet.cargoShip == this)
        {
            return;
        }
        if (shipModel.Fule < shipModel.FuleCR)
        {
            if (fleet.cargoShip.shipModel.Fule > shipModel.FuleMax)
            {
                float getFule = shipModel.FuleMax - shipModel.Fule;
                shipModel.Fule += getFule;
                fleet.cargoShip.shipModel.Fule -= getFule;
            }
        }
    }

}
